process.cwd() returns the current working directory of the Node.js process, while __dirname returns the directory name of the current module.

console.log(process.cwd());
// /Users/username/projects/nodejs
 
console.log(__dirname);
// /Users/username/projects/nodejs/src